#include <iostream>
#include <stdio.h>
#define MAXSIZE 20
#define LT(a,b) ((a)<(b))
typedef int KeyType;
using namespace std;

typedef struct
{
    KeyType key;
}RedType;

typedef struct
{
    RedType r[MAXSIZE+1];
    int length;
}SqList;

void BInsertSort(SqList &L)
{
    int i,j,k,low,high,m;
    for(i=2;i<=L.length;i++)
    {
        L.r[0]=L.r[i];
        low=1;
        high=i-1;
        while(low<=high)
        {
            m=(low+high)/2;
            if(LT(L.r[0].key,L.r[m].key))
                high=m-1;
            else
                low=m+1;
        }
        for(j=i-1;j>=high+1;j--)
            L.r[j+1]=L.r[j];
        L.r[high+1]=L.r[0];
        for(k=1;k<=L.length;k++)
            printf("%d ",L.r[k].key);
        printf("\n");
    }
}
int main()
{
    SqList L;
    int i;
    scanf("%d",&L.length);
    for(i=1;i<=L.length;i++)
        scanf("%d",&L.r[i].key);
    BInsertSort(L);
    return 0;
}
